<template>
	<view class="">
		<u-cell-group>
		    <u-cell v-for="(item,index) in myGroupList" :key="item.id">
				<view slot="icon">
				<u-avatar :src="item.picture"></u-avatar>
				</view>
		    	<view
		    	    slot="title"
		    	    class="u-slot-title"
					@click="goChat(item)"
		    	>
					{{item.account}}
		    	</view>
		    </u-cell>
			
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				myGroupList:[]
			}
		},
		mounted() {
			this.getMyJoinGroupList()
		},
		methods:{
			getMyJoinGroupList(){
				this.$myRquest({
					url:'/group/list',
					method:"get"
				}).then(res=>{
					this.myGroupList=res.data.data
				})
			},
			goChat(group){
			
				group.accept_type=2 //用于区分群还是个人
				this.$store.commit('chat/setChatObjectData',group)
				uni.navigateTo({
					url:'/pages/chat/index'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.u-slot-title{
		width: 450rpx;
	}
</style>
